package com.loveazure.bll;

import com.loveazure.bll.algorithm.Algorithm;
import com.loveazure.eo.User;
import com.loveazure.eo.UserCourse;
import com.loveazure.ui.MainFrame;

public class Handler implements IHandler {

	private static Handler handler;

	private Operation oper;
	private User currentUser;
	private MainFrame frame;
	private LearnedProgress progress;
	private Algorithm algorithm;
	private UserCourse currentCourse;

	public UserCourse getUserCourse() {
		return currentCourse;
	}

	public void setCurrentCourse(UserCourse currentCourse) {
		this.currentCourse = currentCourse;
	}

	private Handler() {
	}

	public Algorithm getAlgorithm() {
		return algorithm;
	}

	public void setAlgorithm(Algorithm algorithm) {
		this.algorithm = algorithm;
	}

	public void setOper(Operation oper) {
		this.oper = oper;
	}

	public LearnedProgress getProgress() {
		if (progress == null) {
			progress = new LearnedProgress();
		}
		return progress;
	}

	public void setFrame(MainFrame frame) {
		this.frame = frame;
	}

	public MainFrame getFrame() {
		return frame;
	}

	public Operation getOper() {
		return oper;
	}

	public User getUser() {
		return currentUser;
	}

	public void setUser(User user) {
		this.currentUser = user;
	}

	public static Handler getInstance() {
		if (handler == null) {
			handler = new Handler();
		}
		return handler;
	}
}
